package com.hackordie.daos.mappers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.hackordie.commons.authorities.User;

public class UserMapper implements RowMapper<User> {

	@Override
	public User mapRow(final ResultSet result, final int row) throws SQLException {
		User user = new User();
		
		user.setId(result.getInt("idUser"));
		user.setUserName(result.getString("name"));
		user.setUserPassword(result.getString("password"));
		user.setEmail(result.getString("email"));
		user.setSigninDate(result.getDate("signinDate"));
		user.setEnabled(result.getBoolean("enabled"));
		user.setRole(result.getInt("idRole"));
		user.setMoney(result.getInt("money"));
		
		return user;
	}
}
